package com.zhongxi.guoyuan.adapter.rewardCoin;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.zhongxi.guoyuan.R;

import java.util.List;

/**
 * Created by Administrator on 2016/11/28.
 */

public class RewardCoinApplyAdapter extends BaseAdapter {

    private Context context;
    private List<String> list;
    private LayoutInflater mLayoutInflater;

    public RewardCoinApplyAdapter(Context context, List<String> data) {
        this.context = context;
        mLayoutInflater = LayoutInflater.from(context);
        this.list = data;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = mLayoutInflater.inflate(R.layout.item_reward_coin_shop, parent, false);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        return convertView;
    }

    class ViewHolder{
        private ImageView ivImg;
        private TextView tvName;
        private TextView tvNature;
        private TextView tvPrice;
    }
}
